package com.inforich.screenData.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inforich.common.utils.DateUtils;
import com.inforich.screenData.domain.ReportView;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inforich.screenData.mapper.ReportProjectTransportMapper;
import com.inforich.screenData.domain.ReportProjectTransport;
import com.inforich.screenData.service.IReportProjectTransportService;

/**
 * 项目运输日汇总Service业务层处理
 *
 * @author hjm
 * @date 2022-10-27
 */
@Service
public class ReportProjectTransportServiceImpl extends
    ServiceImpl<ReportProjectTransportMapper, ReportProjectTransport> implements
    IReportProjectTransportService {

  @Override
  public Page<ReportProjectTransport> pageReportProjectTransport(Page<ReportProjectTransport> page,
      Map<String, Object> map) {
    return baseMapper.pageReportProjectTransport(page, map);
  }

  @Override
  public List<ReportProjectTransport> listReportProjectTransport(Map<String, Object> map) {
    return baseMapper.listReportProjectTransport(map);
  }

  @Override
  public Boolean checkConflict(ReportProjectTransport reportProjectTransport) {
    return this.count(new LambdaQueryWrapper<ReportProjectTransport>().eq(
            ReportProjectTransport::getStatisticsDate,
            DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, reportProjectTransport.getStatisticsDate()))
        .ne(reportProjectTransport.getId() != null, ReportProjectTransport::getId,
            reportProjectTransport.getId())) > 0;
  }

}
